//ConsistentLeaf类
package cn.edu.scau.cmi.yangzhichao.composite.consistent;



public class ConsistentLeaf extends ConsistentComponent{
    public ConsistentLeaf(String name) {
        super(name);
    }

    @Override
    public void display(int level) {
        for(int i=0;i<level;i++){
            ConsistentCompositeViewController.addToTextView("-");
        }
        ConsistentCompositeViewController.addToTextView(name+"\r\n");
    }

    @Override
    public void addChild(ConsistentComponent consistentComponent) {
        ConsistentCompositeViewController.addToTextView("不能往叶子中添加结点");
    }

    @Override
    public void deleteChild(int index) {
        ConsistentCompositeViewController.addToTextView("不能删除自己");
    }

    @Override
    public void updateChild(ConsistentComponent consistentComponent, int index) {
        ConsistentCompositeViewController.addToTextView("不能更新自己");
    }
}
